<?php
/*********************************************
  CPG Dragonfly™ CMS
  ********************************************
  Copyright © 2004 - 2005 by CPG-Nuke Dev Team
  http://dragonflycms.org

  Dragonfly is released under the terms and conditions
  of the GNU GPL version 2 or any later version
**********************************************/
if (!defined('CPG_NUKE')) { exit; }
define('THEME_VERSION', '10');

$gfxcolor = '#C0C000';
$bgcolor1 = $bgcolor2 = $bgcolor3 = $bgcolor4 = 'transparent';
$textcolor1 = $textcolor2 = '';

$cpgtpl->tpl_header = 'header';
$cpgtpl->tpl_footer = 'footer';

function OpenTable()   { echo '<div class="table1">'; }
function CloseTable()  { echo '</div>'; }

function OpenTable2()  { echo '<div class="table2">'; }
function CloseTable2() { echo '</div>'; }

function themeheader()
{
	global $cpgtpl, $MAIN_CFG, $Module;

	include(__DIR__.'/cssmainmenu.php');

	Dragonfly_Output_Css::add('cpgmm');
	Dragonfly_Output_Css::add('poodle/tabs');
	Dragonfly_Output_Css::add('poodle/forms');
	Dragonfly_Output_Js::add('poodle/javascript/tabs.js');
	Dragonfly_Output_Js::add('includes/poodle/javascript/forms.js');
	Dragonfly_Output_Js::add('themes/default/javascript/toggle.js');

	$cpgtpl->assign_vars(array(
		'CSS_DATA'    => Dragonfly_Output_Css::flushToTpl(),
		'JS_DATA'     => Dragonfly_Output_Js::flushToTpl(),
		'RSS_DATA'    => $Module->active && is_file($Module->chroot .'feed_rss.inc') ? '?feed='. $Module->name : false,

		'S_LOGO'      => $MAIN_CFG['global']['site_logo'],
		'S_SITENAME'  => $MAIN_CFG['global']['sitename'],
		'S_BANNER'    => ($MAIN_CFG['global']['banners']) ? viewbanner() : '',
		'S_MAIN_MENU' => $mmcontent,
	));
}

function themefooter()
{
	global $cpgtpl;
	$cpgtpl->assign_var('S_FOOTER', footmsg());
	$cpgtpl->display('footer');
}

/***********************************************************************************

 string theme_open_form

 Creates start tag for form
	$link : link for action default blank
	$form_name : useful for styling and nbbcode
	$legend: optional string value is used in form lagend tag
	$border: optional use 1 to not show border on fieldset from stylesheet
************************************************************************************/
function theme_open_form($link, $form_name=false, $legend=false, $tborder=false)
{
	$form_name	= $form_name ? ' id="'.$form_name.'"' :'';
	return '<form method="post" action="'.$link.'"'.$form_name.'><fieldset>'
		.($legend ? "<legend>{$legend}</legend>" : '');
}
function theme_close_form()
{
	return '</fieldset></form>';
}
/***********************************************************************************

 string theme_yesno_option

 Creates 2 radio buttons with a Yes and No option
	$name : name for the <input>
	$value: current value, 1 = yes, 0 = no

************************************************************************************/
function theme_yesno_option($name, $value=0)
{
	$sel[(!$value)] = '';
	$sel[$value] = ' selected="selected"';
	$select = '<select name="'.$name.'" id="'.$name."\">\n";
	$select .= '<option value="1"'.$sel[1].">"._YES."</option>\n";
	$select .= '<option value="0"'.$sel[0].">"._NO."</option>\n";
	return $select.'</select>';
}
/***********************************************************************************

 string theme_select_option

 Creates a selection dropdown box of all given variables in the array
	$name : name for the <select>
	$value: current/default value
	$array: array like array("value1","value2")

************************************************************************************/
function theme_select_option($name, $value, array $array)
{
	$sel[$value] = ' selected="selected"';
	$select = '<select name="'.$name.'" id="'.$name."\">\n";
	foreach ($array as $var) {
		$select .= '<option'.(isset($sel[$var])?$sel[$var]:'').">$var</option>\n";
	}
	return $select.'</select>';
}
/***********************************************************************************

 string theme_select_box

 Creates a selection dropdown box of all given variables in the multi array
	$name : name for the <select>
	$value: current/default value
	$array: array like array("value1 => title1","value2 => title2")

************************************************************************************/
function theme_select_box($name, $value, array $array)
{
	$select = '<select name="'.$name.'" id="'.$name."\">\n";
	foreach ($array as $val => $title) {
		$select .= "<option value=\"{$val}\"".(($val==$value)?' selected="selected"':'').">{$title}</option>\n";
	}
	return $select.'</select>';
}
